import { Component, EventEmitter, Input, Output, OnInit, OnChanges } from '@angular/core';
import { Assembly, AssemblyStyles, AssemblyValidators } from '../../../fb-design.model'
import { SelectItem } from 'primeng/primeng';
@Component({
    selector: 'qk-calendar-attributes',
    templateUrl: 'qk-calendar-attributes.component.html',
    styleUrls: ['qk-calendar-attributes.component.scss'],
    providers: []
})
export class QkCalendarAttributes implements OnInit {
    @Input() assembly;
    @Output() onAttrChangedEmitter = new EventEmitter<Assembly>();
    @Input() 
    set names(names: string[]){
        let temp = [];
        names.forEach(e => temp.push({label: e, value: e}));
        this.nameItems = temp;
    }

    yesNo: SelectItem[] = [{ label: '否', value: false }, { label: '是', value: true }];
    dateFormat: SelectItem[] = [{ label: '年-月-日', value: 'yy-mm-dd' }];
    nameItems: SelectItem[];
    constructor() {
    }

    valueChange() {
        this.assembly.attributes.refreshStyle();
        this.onAttrChangedEmitter.emit(this.assembly);
    }

    ngOnInit() {
    }

}